package com.example.experiment4;

import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

public class EmailActivity extends AppCompatActivity implements View.OnClickListener {
    private Button sendBtn;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_email);

        sendBtn = (Button) findViewById(R.id.send_btn);
        sendBtn.setOnClickListener(this);
    }
    @Override
    public void onClick(View v) {
        switch(v.getId()){
            case R.id.send_btn:
                sendEmail();
                break;
        }
    }
    
    private void sendEmail(){
        Intent data=new Intent(Intent.ACTION_SENDTO);
        data.setData(Uri.parse("mailto:cn_zdy@126.com"));
        data.putExtra(Intent.EXTRA_SUBJECT, "提交答案");
        data.putExtra(Intent.EXTRA_TEXT, "下面给出题目的回答：");
        startActivity(data);
    }
}